﻿using Little.Soldier.SWIFT;
using Little.Soldier.SWIFT.Definition;
using System.Collections.Generic;
using System.ComponentModel;

namespace Little.Soldier.SWIFT.Messages.Category9
{
  public class MT941 : SwiftMessage
  {
    private static SwiftMessageDefinition MessageDefinition;
    private static SwiftTagDefinition U0002;
    private static SwiftTagSubItemDefinition U0003;
    private static SwiftTagDefinition U0004;
    private static SwiftTagSubItemDefinition U0005;
    private static SwiftTagDefinition U0006;
    private static SwiftTagSubItemDefinition U0007;
    private static SwiftTagDefinition U0008;
    private static SwiftTagSubItemDefinition U000E;
    private static SwiftTagSubItemDefinition U000F;
    private static SwiftTagSubItemDefinition U0010;
    private static SwiftTagDefinition U0011;
    private static SwiftTagSubItemDefinition U0012;
    private static SwiftTagSubItemDefinition U0013;
    private static SwiftTagSubItemDefinition U0014;
    private static SwiftTagSubItemDefinition U0015;
    private static SwiftTagDefinition U0016;
    private static SwiftTagDefinition U0017;
    private static SwiftTagSubItemDefinition U0018;
    private static SwiftTagDefinition U0019;
    private static SwiftTagSubItemDefinition U001A;
    private static SwiftTagDefinition U001B;
    private static SwiftTagDefinition U001C;
    private static SwiftTagDefinition U001D;
    private static SwiftTagDefinition U001E;

    [Description("Transaction Reference Number")]
    public Tag20 TransactionReferenceNumber_20
    {
      get
      {
        return new Tag20((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0002);
      }
    }

    [Description("Transaction Reference Number")]
    public Tag20 Tag20_TransactionReferenceNumber
    {
      get
      {
        return this.TransactionReferenceNumber_20;
      }
    }

    [Description("Related Reference")]
    public Tag21 RelatedReference_21
    {
      get
      {
        return new Tag21((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0004);
      }
    }

    [Description("Related Reference")]
    public Tag21 Tag21_RelatedReference
    {
      get
      {
        return this.RelatedReference_21;
      }
    }

    [Description("Account Identification")]
    public Tag25 AccountIdentification_25
    {
      get
      {
        return new Tag25((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0006);
      }
    }

    [Description("Account Identification")]
    public Tag25 Tag25_AccountIdentification
    {
      get
      {
        return this.AccountIdentification_25;
      }
    }

    [Description("Statement Number/Sequence Number")]
    public Tag28 StatementNumberSequenceNumber_28
    {
      get
      {
        return new Tag28((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0008);
      }
    }

    [Description("Statement Number/Sequence Number")]
    public Tag28 Tag28_StatementNumberSequenceNumber
    {
      get
      {
        return this.StatementNumberSequenceNumber_28;
      }
    }

    [Description("Date/Time Indication")]
    public Tag13D DateTimeIndication_13D
    {
      get
      {
        return new Tag13D((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0011);
      }
    }

    [Description("Date/Time Indication")]
    public Tag13D Tag13D_DateTimeIndication
    {
      get
      {
        return this.DateTimeIndication_13D;
      }
    }

    [Description("Opening Balance")]
    public Tag60F OpeningBalance_60F
    {
      get
      {
        return new Tag60F((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0016);
      }
    }

    [Description("Opening Balance")]
    public Tag60F Tag60F_OpeningBalance
    {
      get
      {
        return this.OpeningBalance_60F;
      }
    }

    [Description("Number and Sum of Entries ")]
    public Tag90D NumberAndSumOfEntries_90D
    {
      get
      {
        return new Tag90D((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0017);
      }
    }

    [Description("Number and Sum of Entries ")]
    public Tag90D Tag90D_NumberAndSumOfEntries
    {
      get
      {
        return this.NumberAndSumOfEntries_90D;
      }
    }

    [Description("Number and Sum of Entries")]
    public Tag90C NumberAndSumOfEntries_90C
    {
      get
      {
        return new Tag90C((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U0019);
      }
    }

    [Description("Number and Sum of Entries")]
    public Tag90C Tag90C_NumberAndSumOfEntries
    {
      get
      {
        return this.NumberAndSumOfEntries_90C;
      }
    }

    [Description("Closing Balance (Booked Funds)")]
    public Tag62F ClosingBalance_62F
    {
      get
      {
        return new Tag62F((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U001B);
      }
    }

    [Description("Closing Balance (Booked Funds)")]
    public Tag62F Tag62F_ClosingBalance
    {
      get
      {
        return this.ClosingBalance_62F;
      }
    }

    [Description("Closing Available Balance (Available Funds)")]
    public Tag64 ClosingAvailableBalance_64
    {
      get
      {
        return new Tag64((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U001C);
      }
    }

    [Description("Closing Available Balance (Available Funds)")]
    public Tag64 Tag64_ClosingAvailableBalance
    {
      get
      {
        return this.ClosingAvailableBalance_64;
      }
    }

    [Description("Forward Available Balance")]
    public Tag65[] ForwardAvailableBalance_65
    {
      get
      {
        int index = -1;
        List<Tag65> list = new List<Tag65>();
        int count;
        do
        {
          ++index;
          Tag65 tag65 = new Tag65((SwiftElement) this, index, (SwiftDefinitionElement) MT941.U001D);
          count = this.ListTags((SwiftElement) tag65).Count;
          if (count > 0)
            list.Add(tag65);
        }
        while (count > 0);
        return list.ToArray();
      }
    }

    [Description("Forward Available Balance")]
    public Tag65[] Tag65_ForwardAvailableBalance
    {
      get
      {
        return this.ForwardAvailableBalance_65;
      }
    }

    [Description("Information To Account Owner")]
    public Tag86 InformationToAccountOwner_86
    {
      get
      {
        return new Tag86((SwiftElement) this, 0, (SwiftDefinitionElement) MT941.U001E);
      }
    }

    [Description("Information To Account Owner")]
    public Tag86 Tag86_InformationToAccountOwner
    {
      get
      {
        return this.InformationToAccountOwner_86;
      }
    }

    public MT941()
      : base(true)
    {
    }

    public MT941(SwiftMessage message)
      : base(message)
    {
    }

    public Tag65 AddForwardAvailableBalance_65()
    {
      return new Tag65((SwiftElement) this, this.ForwardAvailableBalance_65.Length, (SwiftDefinitionElement) MT941.U001D)
      {
        Value = string.Empty
      };
    }

    public void RemoveForwardAvailableBalance_65(Tag65 tag)
    {
      this.RemoveTag(tag.GetTag());
    }

    internal override SwiftMessageDefinition MsgDefinition()
    {
      return MT941.MessageDefinition;
    }

    protected override void InitSwiftMessageDefinition()
    {
      MT941.MessageDefinition = new SwiftMessageDefinition("MT941", "Balance Report");
      MT941.U0002 = new SwiftTagDefinition("TransactionReferenceNumber_20", "Transaction Reference Number");
      MT941.U0002.TagName = ":20:";
      MT941.U0003 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT941.U0002.Elements.Add((SwiftDefinitionElement) MT941.U0003);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0002);
      MT941.U0004 = new SwiftTagDefinition("RelatedReference_21", "Related Reference");
      MT941.U0004.TagName = ":21:";
      MT941.U0004.Mandatory = false;
      MT941.U0005 = new SwiftTagSubItemDefinition("Reference", "Reference");
      MT941.U0004.Elements.Add((SwiftDefinitionElement) MT941.U0005);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0004);
      MT941.U0006 = new SwiftTagDefinition("AccountIdentification_25", "Account Identification");
      MT941.U0006.TagName = ":25:";
      MT941.U0007 = new SwiftTagSubItemDefinition("Account", "Account");
      MT941.U0006.Elements.Add((SwiftDefinitionElement) MT941.U0007);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0006);
      MT941.U0008 = new SwiftTagDefinition("StatementNumberSequenceNumber_28", "Statement Number/Sequence Number");
      MT941.U0008.TagName = ":28:";
      MT941.U000E = new SwiftTagSubItemDefinition("StatementNumber", "Statement Number");
      MT941.U0008.Elements.Add((SwiftDefinitionElement) MT941.U000E);
      MT941.U000F = new SwiftTagSubItemDefinition("StatementNumberSequenceNumber", "Sequence Number");
      MT941.U000F.Mandatory = false;
      MT941.U0010 = new SwiftTagSubItemDefinition("SequenceNumber", "Sequence Number");
      MT941.U000F.Elements.Add((SwiftDefinitionElement) MT941.U0010);
      MT941.U0008.Elements.Add((SwiftDefinitionElement) MT941.U000F);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0008);
      MT941.U0011 = new SwiftTagDefinition("DateTimeIndication_13D", "Date/Time Indication");
      MT941.U0011.TagName = ":13D:";
      MT941.U0011.Mandatory = false;
      MT941.U0012 = new SwiftTagSubItemDefinition("Date", "Date");
      MT941.U0011.Elements.Add((SwiftDefinitionElement) MT941.U0012);
      MT941.U0013 = new SwiftTagSubItemDefinition("Time", "Time");
      MT941.U0011.Elements.Add((SwiftDefinitionElement) MT941.U0013);
      MT941.U0014 = new SwiftTagSubItemDefinition("Sign", "Sign");
      MT941.U0011.Elements.Add((SwiftDefinitionElement) MT941.U0014);
      MT941.U0015 = new SwiftTagSubItemDefinition("Offset", "Offset");
      MT941.U0011.Elements.Add((SwiftDefinitionElement) MT941.U0015);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0011);
      MT941.U0016 = new SwiftTagDefinition("OpeningBalance_60F", "Opening Balance");
      MT941.U0016.TagName = ":60F:";
      MT941.U0016.Mandatory = false;
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0016);
      MT941.U0017 = new SwiftTagDefinition("NumberAndSumOfEntries_90D", "Number and Sum of Entries ");
      MT941.U0017.TagName = ":90D:";
      MT941.U0017.Mandatory = false;
      MT941.U0018 = new SwiftTagSubItemDefinition("NumberCurrencyAndAmount", "Number ,Currency And Amount");
      MT941.U0017.Elements.Add((SwiftDefinitionElement) MT941.U0018);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0017);
      MT941.U0019 = new SwiftTagDefinition("NumberAndSumOfEntries_90C", "Number and Sum of Entries");
      MT941.U0019.TagName = ":90C:";
      MT941.U0019.Mandatory = false;
      MT941.U001A = new SwiftTagSubItemDefinition("NumberCurrencyAndAmount", "Number ,Currency and Amount");
      MT941.U0019.Elements.Add((SwiftDefinitionElement) MT941.U001A);
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U0019);
      MT941.U001B = new SwiftTagDefinition("ClosingBalance_62F", "Closing Balance (Booked Funds)");
      MT941.U001B.TagName = ":62F:";
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U001B);
      MT941.U001C = new SwiftTagDefinition("ClosingAvailableBalance_64", "Closing Available Balance (Available Funds)");
      MT941.U001C.TagName = ":64:";
      MT941.U001C.Mandatory = false;
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U001C);
      MT941.U001D = new SwiftTagDefinition("ForwardAvailableBalance_65", "Forward Available Balance");
      MT941.U001D.TagName = ":65:";
      MT941.U001D.Mandatory = false;
      MT941.U001D.Multiple = true;
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U001D);
      MT941.U001E = new SwiftTagDefinition("InformationToAccountOwner_86", "Information To Account Owner");
      MT941.U001E.TagName = ":86:";
      MT941.U001E.Mandatory = false;
      MT941.MessageDefinition.Elements.Add((SwiftDefinitionElement) MT941.U001E);
    }
  }
}
